package com.wicket.okrcomponent.biz.service.nb;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.wicket.okrcomponent.common.util.CommonFunctionHelper;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import com.wicket.okrcomponent.biz.service.dto.req.ObtainReceiveFieldsReqDto;
import com.wicket.okrcomponent.biz.service.dto.res.ObtainReceiveFieldsRespDto;
import com.wicket.okrcomponent.biz.service.dto.req.QueryObtainSecurityParamDataDetailReqDto;
import com.wicket.okrcomponent.biz.service.dto.res.QueryObtainSecurityParamDataDetailRespDto;

/**
 * @author ： 手工接入方法
 * @since 2022/5/28 15:32
 *
 *
 * @version 1.0
 */
@Service
public class NbSecurity {
/**
      * code:receptionService
      * name:M2-约定允许操作
      * desc:undefined
      * gen by moon at 1/21/2023, 9:58:48 AM
      * 
      **/
     @Trace(operationName = "M2-约定允许操作")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public ObtainReceiveFieldsRespDto obtainReceiveFields(ObtainReceiveFieldsReqDto reqDto) {
         return BeanUtil.toBean(reqDto,ObtainReceiveFieldsRespDto.class);
      }
/**
      * code:obtainSecureParam
      * name:M2获取物理化钥匙参数
      * desc:undefined
      * gen by moon at 5/9/2023, 5:20:57 AM
      *
      **/
     @Trace(operationName = "M2获取物理化钥匙参数")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryObtainSecurityParamDataDetailRespDto queryObtainSecurityParamDataDetail(QueryObtainSecurityParamDataDetailReqDto reqDto) {
         QueryObtainSecurityParamDataDetailRespDto retData = new QueryObtainSecurityParamDataDetailRespDto();
         String data = CommonFunctionHelper.getSecStr();
         //data = "{\"branchName\":\"新数质测试\",\"info\":{\"111\":{\"applexName\":\"111\",\"authorizationEndTime\":\"111\",\"authorizationId\":\"777\",\"authorizationName\":\"新数质证书\",\"authorizationNum\":\"111\",\"authorizationObjectId\":\"111\",\"authorizationObjectType\":\"111\",\"authorizationSchemeId\":\"111\",\"authorizationSpaceId\":\"111\",\"authorizationStartTime\":\"111\",\"authorizationUnit\":\"111\",\"deployTypeCode\":\"111\",\"dnsAddresses\":\"111\",\"ipAddresses\":\"111\",\"isDeploymentEnabled\":\"111\",\"isMainAuthorization\":\"111\",\"schOpenRecordCode\":\"111\",\"schOpenRecordId\":\"111\",\"schemeAuthorizationType\":\"111\",\"serverMacCode\":\"111\",\"spaceShortName\":\"111\"},\"222\":{\"applexName\":\"222\",\"authorizationEndTime\":\"222\",\"authorizationId\":\"777\",\"authorizationName\":\"新数质证书\",\"authorizationNum\":\"222\",\"authorizationObjectId\":\"222\",\"authorizationObjectType\":\"222\",\"authorizationSchemeId\":\"222\",\"authorizationSpaceId\":\"222\",\"authorizationStartTime\":\"222\",\"authorizationUnit\":\"222\",\"deployTypeCode\":\"222\",\"dnsAddresses\":\"222\",\"ipAddresses\":\"222\",\"isDeploymentEnabled\":\"222\",\"isMainAuthorization\":\"222\",\"schOpenRecordCode\":\"222\",\"schOpenRecordId\":\"222\",\"schemeAuthorizationType\":\"222\",\"serverMacCode\":\"222\",\"spaceShortName\":\"222\"}}}";
         JSONObject jsonObject = JSONObject.parseObject(data);
         JSONObject infoObject = jsonObject.getJSONObject("info");
         JSONObject target = infoObject.getJSONObject(reqDto.getAuthorizationKeyTypeCode());
         BeanUtil.fillBeanWithMap(target, retData, true);
         retData.setApplObjType(target.getString("authorizationKeyTypeCode"));
        return retData;
      }

    public static void main(String[] args) {
        NbSecurity o = new NbSecurity();
        o.queryObtainSecurityParamDataDetail(null);
    }
  //手工接入方法
}
